﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user_edit.aspx.cs" Inherits="AnyOffice.general.system.user.user_edit" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>编辑用户</title>
		
		<script src="/aspnet_client/core/function.js"></script>
		<script>
function CheckForm()
{  
   if(document.Form1.txtUserName.value == "")
   {
	 alert("姓名不能为空！");
	 document.Form1.txtUserName.focus();
	 return (false);
   }
   
   if(document.Form1.ddlSex.value == "")
   {
	 alert("请选择性别！");
	 document.Form1.ddlSex.focus();
	 return (false);
   }
   
   if(document.Form1.ddlDeptId.value == "")
   {   
	 alert("请选择部门！");	
	 return (false);
   }
   
   if(!checkIsInteger(document.Form1.txtUserNo.value) || document.Form1.txtUserNo.value == "")
   {   
	 alert("用户排序号不能为空，且必须为整数！");
	 document.Form1.txtUserNo.focus();
	 return (false);
   }
   
    if(document.Form1.ddlUserPriv.value == "")
   {   
	 alert("请选择角色！");	
	 return (false);
   }   
   
    if((document.Form1.ddlPostPriv.value == "2") && (document.Form1.ToId.value == ""))
   {
	 alert("请选择管理范围（部门）！");	
	 return (false);
   }
   
   	if(!checkIsInteger(document.Form1.txtEmailCapacity.value) || document.Form1.txtEmailCapacity.value == "")
   {   
	 alert("内部邮箱容量不能为空，且必须为整数！");
	 document.Form1.txtEmailCapacity.focus();
	 return (false);
   }
   
   if(!checkIsInteger(document.Form1.txtFolderCapacity.value) || document.Form1.txtFolderCapacity.value == "")
   {   
	 alert("我的文件柜容量不能为空，且必须为整数！");
	 document.Form1.txtFolderCapacity.focus();
	 return (false);
   }  
   
   return true;
}

function select_dept()
{
   if (document.getElementById("ddlPostPriv").value=="2")
       document.getElementById("postdept_select").style.display='';
   else
       document.getElementById("postdept_select").style.display="none";
}

function CheckDate(op)
{
   mon=document.Form1.ddlBirthday_Mon.value;
   year=document.Form1.ddlBirthday_Year.value;

   if(mon=="4" || mon=="6" || mon=="9" || mon=="11")
   {
     if(document.Form1.ddlBirthday_Day.options.length>30)
         document.Form1.ddlBirthday_Day.remove(30);
     else if(document.Form1.ddlBirthday_Day.options.length<30)
     {
       if(document.Form1.ddlBirthday_Day.options.length==28)
       {
         var my_option = document.createElement("OPTION");
         my_option.text="29";
         my_option.value="29";
         document.Form1.ddlBirthday_Day.add(my_option);
       }

       var my_option = document.createElement("OPTION");
       my_option.text="30";
       my_option.value="30";
       document.Form1.ddlBirthday_Day.add(my_option);
     }
   }

   else if(mon=="2")
   {
     document.Form1.ddlBirthday_Day.remove(30);
     document.Form1.ddlBirthday_Day.remove(29);

     if(document.Form1.ddlBirthday_Day.options.length>28)
     if (!(year%400==0 || (year%4==0 && year%100!=0)))
       document.Form1.ddlBirthday_Day.remove(28);

     if(document.Form1.ddlBirthday_Day.options.length<29)
     if ((year%400==0 || (year%4==0 && year%100!=0)))
     {
       var my_option = document.createElement("OPTION");
       my_option.text="29";
       my_option.value="29";
       document.Form1.ddlBirthday_Day.add(my_option);
     }
   }
   else
   {
     if(document.Form1.ddlBirthday_Day.options.length<31)
     {
       if(document.Form1.ddlBirthday_Day.options.length==28)
       {
         var my_option = document.createElement("OPTION");
         my_option.text="29";
         my_option.value="29";
         document.Form1.ddlBirthday_Day.add(my_option);
       }

       if(document.Form1.ddlBirthday_Day.options.length==29)
       {
         var my_option = document.createElement("OPTION");
         my_option.text="30";
         my_option.value="30";
         document.Form1.ddlBirthday_Day.add(my_option);
       }

       var my_option = document.createElement("OPTION");
       my_option.text="31";
       my_option.value="31";
       document.Form1.ddlBirthday_Day.add(my_option);
     }
   }
}
		</script>
	</HEAD>
	<body class="bodycolor" topmargin="5">
		<form id="Form1" method="post" runat="server">
         <div class="main_div">				
			<asp:Panel id="pnlMain" runat="server">
			<table border="0" width="100%" cellspacing="0" cellpadding="3" class="small">
				<tr>
					<td class="tab_ti">
							用户编辑
					</td>
				</tr>
			</table>
				<TABLE class="tab_pub" cellSpacing="0" cellPadding="0" width="90%" align="center" border="0" >
					<TBODY>
						<TR>
						<TD class="TableHeader" noWrap colSpan="2"><IMG src="/images/green_arrow.gif" align="absMiddle">
							以下选项由管理员设置：</TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap>用户名：</TD>
							<TD class="ta_txt" noWrap>
								<asp:Label id="lblUserId" runat="server" Font-Bold="True"></asp:Label></TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap>真实姓名：</TD>
							<TD class="ta_txt" noWrap>
								<asp:TextBox id="txtUserName" runat="server" CssClass="BigInput" Width="100px" MaxLength="20"></asp:TextBox></TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap>部门：</TD>
							<TD class="ta_txt" noWrap>
								<asp:DropDownList id="ddlDeptId" runat="server" CssClass="BigSelect"></asp:DropDownList>
								<br>
								如设置为离职人员/外部人员，将对其他用户不可见
							</TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap>用户排序号：</TD>
							<TD class="ta_txt" noWrap>
								<asp:TextBox id="txtUserNo" runat="server" MaxLength="4" CssClass="BigInput" Columns="6"></asp:TextBox>&nbsp;用于同角色用户的排序</TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap>角色：</TD>
							<TD class="ta_txt" noWrap>
								<asp:DropDownList id="ddlUserPriv" runat="server" CssClass="BigSelect"></asp:DropDownList></TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap width="120">管理范围（如果有权限执行管理型模块）：</TD>
							<TD class="ta_txt" noWrap><SELECT class="BigSelect" id="ddlPostPriv" onChange="select_dept()" name="ddlPostPriv" runat="server">
									<OPTION value="0">本部门</OPTION>
									<OPTION value="1">全体</OPTION>
									<OPTION value="2">指定部门</OPTION>
								</SELECT>
							</TD>
						</TR>
						<TR id="postdept_select" style="DISPLAY: none">
							<TD class="ta_bg" noWrap>管理范围（部门）：</TD>
							<TD class="ta_txt"><INPUT id="ToId" type="hidden" name="ToId" runat="server">
							<TEXTAREA class="BigStatic fl" id="ToName" name="ToName" rows="3" readOnly wrap="yes" cols="40" runat="server"></TEXTAREA>
							<INPUT class="bnt_Add fl" style="width:50px; display:inline-table;" title="添加部门" onClick="dept_select('ToId','ToName','true');" type="button" value="添加" name="button">
							<INPUT class="bnt_Del fl" style="width:50px; display:inline-table;" title="清空部门" onClick="clear_double('ToId','ToName');" type="button" value="清空" name="button">
							</TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap>内部邮箱容量：</TD>
							<TD class="ta_txt">
								<asp:TextBox id="txtEmailCapacity" runat="server" MaxLength="4" CssClass="BigInput" Columns="6"></asp:TextBox>MB 
								为0则表示不限制大小
							</TD>
						</TR>
						<TR>
							<TD class="ta_bg" noWrap>我的文件柜容量：</TD>
							<TD class="ta_txt">
								<asp:TextBox id="txtFolderCapacity" runat="server" MaxLength="4" CssClass="BigInput" Columns="6"></asp:TextBox>MB 
								为0则表示不限制大小</TD>
						</TR>
						<TR>
						<TD class="ta_bg" noWrap>绑定IP地址：</TD>
						<TD class="ta_txt">
							<asp:TextBox ID="txtBindIp" runat="server" Columns="30" TextMode="MultiLine"></asp:TextBox>
							为空则该用户不绑定固定的IP地址，多个IP地址以,分隔
						</TD>
					</TR>
						<TR>
							<TD class="ta_bg" noWrap>帐户禁用：</TD>
							<TD class="ta_txt">
								<asp:CheckBox id="ckbDisable" runat="server"></asp:CheckBox></TD>
						</TR>
						<TR>
						<TD class="TableHeader" noWrap colSpan="2"><IMG src="/images/green_arrow.gif" align="absMiddle">
							以下选项用户可自行设置：</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>别名：</TD>
						<TD class="ta_txt">
							<asp:TextBox id="txtUserId2" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"></asp:TextBox>
							<br>用户可用此别名登录系统，别名不能与其他用户的别名或用户名相同
						</TD>
					</TR>
					
					<TR>
						<TD class="ta_bg" noWrap>性别：</TD>
						<TD class="ta_txt" noWrap>
							<asp:DropDownList id="ddlSex" runat="server" CssClass="BigSelect">
								<asp:ListItem Value="true">男</asp:ListItem>
								<asp:ListItem Value="false">女</asp:ListItem>
							</asp:DropDownList></TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>生日：</TD>
						<TD class="ta_txt" noWrap>
							<!-------------- 年 ------------>
							<SELECT class="BigSelect" id="ddlBirthday_Year" onChange="CheckDate();" name="ddlBirthday_Year"
								runat="server">
								<OPTION value="1900">1900</OPTION>
								<OPTION value="1901">1901</OPTION>
								<OPTION value="1902">1902</OPTION>
								<OPTION value="1903">1903</OPTION>
								<OPTION value="1904">1904</OPTION>
								<OPTION value="1905">1905</OPTION>
								<OPTION value="1906">1906</OPTION>
								<OPTION value="1907">1907</OPTION>
								<OPTION value="1908">1908</OPTION>
								<OPTION value="1909">1909</OPTION>
								<OPTION value="1910">1910</OPTION>
								<OPTION value="1911">1911</OPTION>
								<OPTION value="1912">1912</OPTION>
								<OPTION value="1913">1913</OPTION>
								<OPTION value="1914">1914</OPTION>
								<OPTION value="1915">1915</OPTION>
								<OPTION value="1916">1916</OPTION>
								<OPTION value="1917">1917</OPTION>
								<OPTION value="1918">1918</OPTION>
								<OPTION value="1919">1919</OPTION>
								<OPTION value="1920">1920</OPTION>
								<OPTION value="1921">1921</OPTION>
								<OPTION value="1922">1922</OPTION>
								<OPTION value="1923">1923</OPTION>
								<OPTION value="1924">1924</OPTION>
								<OPTION value="1925">1925</OPTION>
								<OPTION value="1926">1926</OPTION>
								<OPTION value="1927">1927</OPTION>
								<OPTION value="1928">1928</OPTION>
								<OPTION value="1929">1929</OPTION>
								<OPTION value="1930">1930</OPTION>
								<OPTION value="1931">1931</OPTION>
								<OPTION value="1932">1932</OPTION>
								<OPTION value="1933">1933</OPTION>
								<OPTION value="1934">1934</OPTION>
								<OPTION value="1935">1935</OPTION>
								<OPTION value="1936">1936</OPTION>
								<OPTION value="1937">1937</OPTION>
								<OPTION value="1938">1938</OPTION>
								<OPTION value="1939">1939</OPTION>
								<OPTION value="1940">1940</OPTION>
								<OPTION value="1941">1941</OPTION>
								<OPTION value="1942">1942</OPTION>
								<OPTION value="1943">1943</OPTION>
								<OPTION value="1944">1944</OPTION>
								<OPTION value="1945">1945</OPTION>
								<OPTION value="1946">1946</OPTION>
								<OPTION value="1947">1947</OPTION>
								<OPTION value="1948">1948</OPTION>
								<OPTION value="1949">1949</OPTION>
								<OPTION value="1950">1950</OPTION>
								<OPTION value="1951">1951</OPTION>
								<OPTION value="1952">1952</OPTION>
								<OPTION value="1953">1953</OPTION>
								<OPTION value="1954">1954</OPTION>
								<OPTION value="1955">1955</OPTION>
								<OPTION value="1956">1956</OPTION>
								<OPTION value="1957">1957</OPTION>
								<OPTION value="1958">1958</OPTION>
								<OPTION value="1959">1959</OPTION>
								<OPTION value="1960">1960</OPTION>
								<OPTION value="1961">1961</OPTION>
								<OPTION value="1962">1962</OPTION>
								<OPTION value="1963">1963</OPTION>
								<OPTION value="1964">1964</OPTION>
								<OPTION value="1965">1965</OPTION>
								<OPTION value="1966">1966</OPTION>
								<OPTION value="1967">1967</OPTION>
								<OPTION value="1968">1968</OPTION>
								<OPTION value="1969">1969</OPTION>
								<OPTION value="1970">1970</OPTION>
								<OPTION value="1971">1971</OPTION>
								<OPTION value="1972">1972</OPTION>
								<OPTION value="1973">1973</OPTION>
								<OPTION value="1974">1974</OPTION>
								<OPTION value="1975">1975</OPTION>
								<OPTION value="1976">1976</OPTION>
								<OPTION value="1977">1977</OPTION>
								<OPTION value="1978">1978</OPTION>
								<OPTION value="1979">1979</OPTION>
								<OPTION value="1980">1980</OPTION>
								<OPTION value="1981">1981</OPTION>
								<OPTION value="1982">1982</OPTION>
								<OPTION value="1983">1983</OPTION>
								<OPTION value="1984">1984</OPTION>
								<OPTION value="1985">1985</OPTION>
								<OPTION value="1986">1986</OPTION>
								<OPTION value="1987">1987</OPTION>
								<OPTION value="1988">1988</OPTION>
								<OPTION value="1989">1989</OPTION>
								<OPTION value="1990">1990</OPTION>
								<OPTION value="1991">1991</OPTION>
								<OPTION value="1992">1992</OPTION>
								<OPTION value="1993">1993</OPTION>
								<OPTION value="1994">1994</OPTION>
								<OPTION value="1995">1995</OPTION>
								<OPTION value="1996">1996</OPTION>
								<OPTION value="1997">1997</OPTION>
								<OPTION value="1998">1998</OPTION>
								<OPTION value="1999">1999</OPTION>
								<OPTION value="2000">2000</OPTION>
								<OPTION value="2001">2001</OPTION>
								<OPTION value="2002">2002</OPTION>
								<OPTION value="2003">2003</OPTION>
								<OPTION value="2004">2004</OPTION>
								<OPTION value="2005">2005</OPTION>
								<OPTION value="2006">2006</OPTION>
								<OPTION value="2007">2007</OPTION>
								<OPTION value="2008">2008</OPTION>
								<OPTION value="2009">2009</OPTION>
								<OPTION value="2010">2010</OPTION>
                                <OPTION value="2011">2011</OPTION>
								<OPTION value="2012">2012</OPTION>
                                <OPTION value="2013">2013</OPTION>
								<OPTION value="2014">2014</OPTION>
							</SELECT>年 
							<!-------------- 月 ------------>
							<SELECT class="BigSelect" id="ddlBirthday_Mon" onChange="CheckDate();" name="ddlBirthday_Mon"
								runat="server">
								<OPTION value="1">01</OPTION>
								<OPTION value="2">02</OPTION>
								<OPTION value="3">03</OPTION>
								<OPTION value="4">04</OPTION>
								<OPTION value="5">05</OPTION>
								<OPTION value="6">06</OPTION>
								<OPTION value="7">07</OPTION>
								<OPTION value="8">08</OPTION>
								<OPTION value="9">09</OPTION>
								<OPTION value="10">10</OPTION>
								<OPTION value="11">11</OPTION>
								<OPTION value="12">12</OPTION>
							</SELECT>月 
							<!-------------- 日 ------------>
							<SELECT class="BigSelect" id="ddlBirthday_Day" name="ddlBirthday_Day" runat="server">
								<OPTION value="1">01</OPTION>
								<OPTION value="2">02</OPTION>
								<OPTION value="3">03</OPTION>
								<OPTION value="4">04</OPTION>
								<OPTION value="5">05</OPTION>
								<OPTION value="6">06</OPTION>
								<OPTION value="7">07</OPTION>
								<OPTION value="8">08</OPTION>
								<OPTION value="9">09</OPTION>
								<OPTION value="10">10</OPTION>
								<OPTION value="11">11</OPTION>
								<OPTION value="12">12</OPTION>
								<OPTION value="13">13</OPTION>
								<OPTION value="14">14</OPTION>
								<OPTION value="15">15</OPTION>
								<OPTION value="16">16</OPTION>
								<OPTION value="17">17</OPTION>
								<OPTION value="18">18</OPTION>
								<OPTION value="19">19</OPTION>
								<OPTION value="20">20</OPTION>
								<OPTION value="21">21</OPTION>
								<OPTION value="22">22</OPTION>
								<OPTION value="23">23</OPTION>
								<OPTION value="24">24</OPTION>
								<OPTION value="25">25</OPTION>
								<OPTION value="26">26</OPTION>
								<OPTION value="27">27</OPTION>
								<OPTION value="28">28</OPTION>
								<OPTION value="29">29</OPTION>
								<OPTION value="30">30</OPTION>
								<OPTION value="31">31</OPTION>
							</SELECT>日&nbsp;
							<asp:CheckBox id="ckbIsHideBirthday" runat="server" Text="生日不公开"></asp:CheckBox>
						</TD>
					</TR>
					<TR>
						<TD class="ta_bg" noWrap>手机：</TD>
						<TD class="ta_txt" noWrap>
							<asp:TextBox id="txtMobile" runat="server" MaxLength="50" CssClass="BigInput" Width="200px"></asp:TextBox>
							<asp:CheckBox id="ckbIsHideMobile" runat="server" Text="手机号码不公开"></asp:CheckBox><BR>
							填写后可接收系统发送的手机短信<BR>
							小灵通请加106及区号，如 106010xxxxxxxx</TD>
					</TR>
						<TR>
							<TD class="bnt_con" noWrap align="center" colSpan="2">
						    <table width="130" cellpadding="0" cellspacing="0" border="0" style="border:none;">
							  <tr>
							    <td align="left" style="border:none;"><INPUT type="submit" value="确 定" onClick="return CheckForm();" class="BigButton"></td>
								<td align="right" style="border:none;"><INPUT class="BigButton" onClick="location='user_dept.aspx?dept_id=<%=ViewState["DeptId"]%>'" type="button" value="返 回"></td>
							  </tr>
							</table>
							</TD>		
		</TR></TBODY>
		</TABLE>
		<br>
		</asp:Panel>
		<asp:Literal id="litUserId2" runat="server"></asp:Literal>
		<asp:Literal id="litMessage" runat="server"></asp:Literal>
        </div>
		</form>
	</body>
</HTML>
